/*
 * MacIPTimes.hpp
 *
 *  Created on: 23.05.2011
 *      Author: mifodix
 */

#ifndef MACIPTIMES_HPP_
#define MACIPTIMES_HPP_

#ifndef __cplusplus
#error Need C++-compile to process this file
#endif

/*
 *
 */
#include "MacIP.hpp"
#include <ctime>

class MacIPTimes: public MacIP
{
private:
	uint32_t leaseTime;
	time_t creationTime;
public:
	MacIPTimes();
	MacIPTimes(const char *mac, size_t macSize, uint32_t ip, uint32_t leaseTime): MacIP(mac, macSize, ip), leaseTime(leaseTime)
	{
		this->creationTime=time(NULL);
	}
	MacIPTimes(const MacIPTimes &copy): MacIP(copy)
	{
		this->leaseTime=copy.leaseTime;
		this->creationTime=copy.creationTime;
	}
	MacIPTimes &operator=(const MacIPTimes &ob)
	{
		if (this!=&ob)
		{
			MacIP::operator =(ob);//хитрый трюк для вызова оператора присваивания родителя
			this->leaseTime=ob.leaseTime;
			this->creationTime=ob.creationTime;
		}
		return *this;
	}
	virtual ~MacIPTimes();
    time_t GetCreationTime() const;
    uint32_t GetLeaseTime() const;
    void SetCreationTime(time_t creationTime);
    void SetLeaseTime(uint32_t leaseTime);
};

#endif /* MACIPTIMES_HPP_ */
